<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>添加/修改员工信息</title>
<c:import url="/ctrl/simpleheader"></c:import>
<script type="text/javascript" src="/scripts/user/detail.js"></script>
</head>
<body>
  <div title="员工信息">
    <div style="padding: 10px 0 10px 60px">
      <table>
        <tr>
          <td>用户名:</td>
          <td><c:choose>
              <c:when test="${user!=null}">
                <c:out value="${user.userName}" />
              </c:when>
              <c:otherwise>
                <input type="text" id="name" name="name"
                  style="width: 160px;"></input>
              </c:otherwise>
            </c:choose></td>
        </tr>
        <tr>
          <td>密码:</td>
          <td><input type="text" id="pwd" name="pwd"></input></td>
        </tr>
        <tr>
          <td>员工姓名:</td>
          <td><input type="text" id="realname" name="realname"
            style="width: 160px;"
            value="<c:out value="${user.userRealName}" />"></input></td>
        </tr>
        <tr>
          <td>状态:</td>
          <td><c:forEach var="status" items="${statusList}">
              <input type="radio" name="status"
                value="<c:out
                      value="${status.index}" />"
                <c:if test="${status.index==user.userIsActive}"> checked="checked"</c:if>>
              <c:out value="${status.name}" />&nbsp;
          </c:forEach></td>
        </tr>
        <tr>
          <td>菜单：</td>
          <td><c:forEach var="menu" items="${config.menuList}">
              <c:out value="${menu.name}" />
              <br />
              <c:forEach var="childmenu" items="${menu.childMenuList}">
                <input type="checkbox" name="menus"
                  value="<c:out
                      value="${childmenu.id}" />"
                  <c:if test="${user!=null&&childmenu.isChecked=='true'}"> checked="checked"</c:if>>
                <c:out value="${childmenu.name}" /><br />
              </c:forEach>              
            </c:forEach></td>
        </tr>
      </table>
    </div>
    <div style="text-align: center; padding: 5px">
      <c:choose>
        <c:when test="${user!=null}">
          <a href="javascript:void(0)"
            onclick="submitModify('<c:out
              value="${user.userId}" />')">保存</a>
        </c:when>
        <c:otherwise>
          <a href="javascript:void(0)" onclick="submitCreate()">添加员工账号</a>
        </c:otherwise>
      </c:choose>
    </div>
  </div>
</body>
</html>